﻿@using Microsoft.FluentUI.AspNetCore.Components
<Error>
	<CascadingAuthenticationState>
		<Router AppAssembly="typeof(Program).Assembly" AdditionalAssemblies="new[] { typeof(Client._Imports).Assembly }">
			<Found Context="routeData">
				<CascadingValue Value="routeData">
					<AuthorizeRouteView RouteData="routeData" DefaultLayout="@DefaultLayout">
						<NotAuthorized>
							<RedirectToLogin />
						</NotAuthorized>
					</AuthorizeRouteView>
					<FocusOnNavigate RouteData="routeData" Selector="h1" />
				</CascadingValue>
			</Found>

			<NotFound>
				<PageTitle>Not found</PageTitle>
				<LayoutView Layout="@DefaultLayout">
					<p role="alert">Sorry, there's nothing at this address.</p>
				</LayoutView>
			</NotFound>
		</Router>
	</CascadingAuthenticationState>
	<AntContainer />

	<FluentToastProvider />
	<FluentDialogProvider />
	<FluentTooltipProvider />
	<FluentMessageBarProvider />
	<FluentMenuProvider />
</Error>

@code {
	[Parameter]
	public Type DefaultLayout { get; set; } = typeof(Layout.MainLayout);
}